#version 430

layout(location = 0) in vec3 Position;
layout(location = 1) in vec3 Normal;

uniform mat4 gWVP;
uniform mat4 gWorld;
uniform vec4 gClipPlane;

out vec3 Normal0;

float gl_ClipDistance[1];

void main()
{
	gl_Position = gWVP*vec4(Position, 1.0);
	Normal0 = (gWorld*vec4(Normal,0.0)).xyz;
	gl_ClipDistance[0] = dot(vec4(Position, 1.0), gClipPlane);//calculate distance of a vertex to clip plane
}